﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
using System.Net;

namespace MetroTube.BusinessLogic
{
    public partial class TestForm : Form
    {
        public TestForm()
        {
            InitializeComponent();
        }

        private void _button_Click(object sender, EventArgs e)
        {
            try
            {
                //YouTubeVideo v = new VideoExtrapolation(new YouTubeHtmlWebPage(_urlTextBox.Text)).Video;

                YouTubeVideo v = VideoExtrapolation.GetVideoExtrapolation(new YouTubeHtmlWebPage(_urlTextBox.Text));

                _richTextBox.Text = v.ToString();
            }
            catch (ArgumentNullException ex0)
            {
                MessageBox.Show(string.Format("0 - Argument null:\n{0}", ex0));
            }
            catch (ArgumentException ex1)
            {
                MessageBox.Show(string.Format("1 - Url not valid:\n{0}", ex1));
            }
            catch (WebException ex2)
            {
                MessageBox.Show(string.Format("2 - Page not found:\n{0}", ex2));
            }
        }

    }
}
